<h5>资产新增</h5>
<div class="content">
  <form #assetForm="ngForm">
    <label>资产信息</label>
    <div class="assetusemsg">
      <div class="form-group  w-33">
        <label class="mr-2"><span class="red">*</span>资产名称</label>
        <input required class="form-control mr-2 w-60" type="text"  placeholder="请输入资产名称" [(ngModel)]="asset.assetName" name="assetName">
        <div class="red" *ngIf="messages.assetName">{{ messages.assetName }}</div>
      </div>

      <div class="form-group w-33 dropdown">
        <label class="mr-2"><span class="red">*</span>资产类别</label>
        <input *ngIf="showchoose" autocomplete="off" required class="form-control mr-2  w-60" type="text"  placeholder="请选择资产类别"  [(ngModel)]="asset.oaAssetType.GDZCLBMC" (click)="showtypeTree()" name="assettypeName">
        <input *ngIf="!showchoose" autocomplete="off" required class="form-control mr-2  w-60" type="text"  placeholder="请选择资产类别"  [(ngModel)]="assettypeName" (click)="showtypeTree()" name="assettypeName">
        <tree-root class="treemenu" *ngIf="typetree" [nodes]="nodes" [options]="options" tabindex=100 (blur)="hidetree()"></tree-root>
        <span class="cursor" (click)="addAssetType()">新增</span>
        <div class="red" *ngIf="messages.assettypeName">{{ messages.assettypeName }}</div>
      </div>

      <div class="form-group  w-33">
        <label class="mr-2"><span class="red">*</span>发票号码</label>
        <input required class="form-control mr-2 w-60" type="text"  placeholder="请输入发票号码" [(ngModel)]="asset.invoiceNum" name="invoiceNum">
        <div class="red" *ngIf="messages.invoiceNum">{{ messages.invoiceNum }}</div>
      </div>

      <div class="form-group  w-33">
        <label class="mr-2"><span class="red">*</span>金额</label>
        <input required class="form-control mr-2 w-60" type="text"  placeholder="请输入金额" [(ngModel)]="asset.assetPrice" name="assetPrice">
        <div class="red" *ngIf="messages.assetPrice">{{ messages.assetPrice }}</div>
      </div>

      <!--地址字段-->
      <div class="form-group  w-33">
        <label class="mr-2"><span class="red">*</span>存放地址</label>
        <input class="form-control mr-2 w-60" type="text"  placeholder="请输入资产存放地址" [(ngModel)]="asset.address" name="address">
      </div>

      <!--座位号字段-->
      <div class="form-group  w-33">
        <label class="mr-2">座位号</label>
        <input class="form-control mr-2 w-60" type="text"  placeholder="请输入座位号" [(ngModel)]="asset.seatNum" name="seatNum">
      </div>

      <div class="form-group w-33 d-flex" appearance="standard">
        <label class="mr-2">购入日期</label>
        <input class="form-control w-60" matInput [matDatepicker]="buypicker" placeholder="选择日期" [value]="asset.buyDateShow?.value"
               (dateChange)="onSelectbuyDate($event)">
        <mat-datepicker-toggle matSuffix [for]="buypicker"></mat-datepicker-toggle>
        <mat-datepicker  #buypicker></mat-datepicker>
      </div>

      <div class="form-group w-33 d-flex" appearance="standard">
        <label class="mr-2">入库时间</label>
        <input class="form-control  w-60" matInput [matDatepicker]="createpicker" placeholder="选择日期" [value]="asset.createDateShow?.value"
               (dateChange)="onSelectcreateDate($event)" [min]="beginCtrl.value">
        <mat-datepicker-toggle matSuffix [for]="createpicker"></mat-datepicker-toggle>
        <mat-datepicker  #createpicker></mat-datepicker>
      </div>

      <div class="form-group  w-33">
        <label class="mr-2">品牌</label>
        <input class="form-control mr-2 w-60" type="text" placeholder="请输入品牌" [(ngModel)]="asset.assetBrand" name="assetBrand">
        <div class="red" *ngIf="messages.assetBrand">{{ messages.assetBrand }}</div>
      </div>
      <div class="form-group  w-33">
        <label class="mr-2">来源</label>
        <select  class="form-control mr-2  w-60" type="text" [(ngModel)]="asset.source" name="assetsource">
          <option [value]="0">自购</option>
          <option [value]="1">租赁</option>
          <option [value]="2">借用</option>
          <option [value]="3">其他</option>
          <option [value]="4">自产</option>
          <option [value]="5">赠送</option>
        </select>
        <div class="red" *ngIf="messages.source">{{ messages.source }}</div>
      </div>
      <div class="form-group  w-33">
        <label class="mr-2">型号</label>
        <input class="form-control mr-2  w-60" type="text"  placeholder="请输入型号" [(ngModel)]="asset.assetVersion" name="assetVersion">
        <div class="red" *ngIf="messages.assetVersion">{{ messages.assetVersion }}</div>
      </div>

      <div class="form-group  w-33">
        <label class="mr-2">渠道</label>
        <input class="form-control mr-2 w-60" type="text"  placeholder="请输入渠道" [(ngModel)]="asset.sourceComefrom" name="sourceComefrom">
      </div>

      <div class="form-group  w-33">
        <label class="mr-2">SN号</label>
        <input class="form-control mr-2 w-60" type="text"  placeholder="请输入SN号" [(ngModel)]="asset.snNum" name="snNum">
      </div>

      <div *ngIf="!showchoose" class="form-group  w-33">
        <label class="mr-2">数量</label>
        <input class="form-control mr-2  w-60" type="number"  placeholder="请输入数量" [(ngModel)]="asset.assetNum" [min]="0" name="assetNum">
      </div>

      <div *ngIf="showchoose" class="form-group  w-33">
        <label class="mr-2">数量</label>
        <input class="form-control mr-2  w-60" type="number"  [(ngModel)]="updateassets.num"  name="num" readonly>
      </div>

      <div *ngIf="!showchoose" class="form-group  w-33">
        <label class="mr-2">总价</label>
        <input class="form-control mr-2 w-60" type="number" [min]="0" [(value)]="asset.assetPrice*asset.assetNum" name="sourceAllnum" readonly>
      </div>

      <div *ngIf="showchoose" class="form-group  w-33">
        <label class="mr-2">总价</label>
        <input class="form-control mr-2 w-60" type="number" [(value)]="asset.assetPrice*updateassets.num" name="sourceAllnum" readonly>
      </div>

    </div>
    <div class="mt-2 mb-2 boundary"></div>
    <div class="d-flex">
      <div class="w-30">
        <label>资产备注</label>
        <div class="form-groupform-group">
          <textarea class="form-control" style="width: 93%;resize: none" [(ngModel)]="asset.remark" name="remark"></textarea>
        </div>
      </div>

      <!--二维码-->
      <div class="w-19" style="position: relative" *ngIf="asset.id">
        <label class="mr-2">二维码</label>
        <div class="qrcodeimg">
          <img [src]="environment.apiUrl + asset.qrcodeUrl" alt="">
        </div>
      </div>

      <div class="w-33" style="position: relative">
        <label class="mr-2">图片</label>
        <span class="grey">最多上传三张图片</span>
        <input class="imgInput" type="file" ng2FileSelect [uploader]="uploader" (change)="ImgsOnChanged($event)" [disabled]="showadd">
        <div class="uploadStyle">
          <span>+</span>
        </div>
        <div class="imgBox">
          <div class="everyimg" *ngFor="let item of imgadd;let i = index">
            <img [src]="environment.apiUrl + item" alt="">
            <span class="text-center cursor" (click)="deleteImg(i)">删除</span>
          </div>
        </div>
      </div>
    </div>
  </form>
</div>
<div class="buttons text-center">
  <button class="btn btn-outline-primary mr-2" type="button" (click)="onSubmit()">保存</button>
  <button class="btn btn-outline-secondary" type="button" [mat-dialog-close] cdkFocusInitial>取消</button>
</div>

